<?php

namespace backend\controllers;

use bc\controller\BackendController;
use bc\model\UnsubscribeModel;
use bc\util\backend\Page;

class UnsubscribeController extends BackendController
{
	/**
	 * 列表页
	 */
	public function actionIndex()
	{
	
		$start_time = $this->get('start_time');
		$end_time = $this->get('end_time');
	
		$model = new UnsubscribeModel();
		$params = '1 = 1';
		
		if($start_time || $end_time)
		{
			
		}
	
		$page = $this->get('page', 1);
		$model->sort = 'log_id DESC';
		$list = $model->getList($params, $page, self::PAGE_SIZE);
	
		$total = $model->getTotal($params);
	
		$pagination = new Page($total, self::PAGE_SIZE);
	
		$view['list'] = $list;
		$view['pagination'] = $pagination;
		$view['start_time'] = $start_time;
		$view['end_time'] = $end_time;
		return $this->render('index', $view);
	
	}
	
	
	
	/**
	 * 编辑
	 */
	public function actionEdit()
	{
		$id = $this->get('id');
	
		if(!$id)
			$this->redirect('/');
	
		$model = new UnsubscribeModel();
		$row = $model->getRow(['report_id' => $id]);
	
	
		$view['row'] = $row;
	
		return $this->render('edit', $view);
	}
}

